﻿using System;
using System.Data;
using System.Windows.Forms;
using System.Text;
using System.Collections.Generic;
using System.IO;

namespace caseDrawer
{
	public class Generator
	{				
	
		
		
		
		
		void generatePositiveResult(DataGridViewRowCollection rows){
			StringBuilder step;
			int stepnum = 1;
			
			foreach(DataGridViewRow row in rows){
				if(row.IsNewRow)
					break;
			
				step   = new StringBuilder();
				
				if(row.Cells[0].Value.ToString()!=null){
					string id			= row.Cells[1].Value.ToString();
					string name			= row.Cells[2].Value.ToString();
					string eventStr 	= convertToAction( row.Cells[0].Value.ToString() );
					bool required		= Convert.ToBoolean( row.Cells[3].Value );
					string triggerStr	= convertToAction( row.Cells[4].Value.ToString() );
					
					step.Append("[STEP]");
					step.Append(stepnum);
					step.Append(": ");
			
					step.Append("User ");
					step.Append(eventStr);
					if(eventStr=="Key Press")
						step.Append("{value}");
					step.Append("at ");
					
					step.Append(name);					
					
					step.Append("		At [STEP] ");
					step.Append(stepnum);
					step.Append(": ");
				}
				
				steps.Add(step.ToString());
				stepnum ++;
			}
			
		}
						
		void generateInTimeValidationResult(DataGridViewRowCollection rows){
			StringBuilder step;
			int stepnum = 1;
			
			foreach(DataGridViewRow row in rows){
				if(row.IsNewRow)
					break;
			
				step   = new StringBuilder();
				
				if(row.Cells[0].Value.ToString()!=null){
					string id			= row.Cells[1].Value.ToString();
					string name			= row.Cells[2].Value.ToString();
					string eventStr 	= convertToAction( row.Cells[0].Value.ToString() );
					string triggerStr	= convertToAction( row.Cells[4].Value.ToString() );
					
					step.Append("[STEP]");
					step.Append(stepnum);
					step.Append(": ");
			
					step.Append("User ");
					step.Append(eventStr);
					if(eventStr=="5")
						step.Append("{value}");
					step.Append("at ");
					
					step.Append(name);					
					
					step.Append("		At [STEP] ");
					step.Append(stepnum);
					step.Append(": ");
					
				}
				
				steps.Add(step.ToString());
				stepnum ++;
			}
			
		}
		
		
		
		
			
			return tmp;
		}
	}
}
